package com.ruoyi.yipaiju.controller;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.ApiResult;
import com.ruoyi.common.enums.dict.SysNormalDisable;
import com.ruoyi.common.utils.bean.Builder;
import com.ruoyi.yipaiju.domain.Banner;
import com.ruoyi.yipaiju.service.IBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/organizations")
public class OrganizationsController extends BaseController {

    @Autowired
    private IBannerService bannerService;

    /**
     * 首页banner
     * @return
     */
    @Anonymous
    @GetMapping("/my/banners")
    public ApiResult myBanners()
    {
        List<Banner> bannerList = bannerService.selectBannerList(Builder.of(Banner::new).with(Banner::setStatus, SysNormalDisable.NORMAL.getValue()).build());
        return ApiResult.success(bannerList);
    }


}
